#redis存储工具
import redis
def warringResultToRedis(type, result,fnc_type):
    # r = getReleaseRedis()
    rDebug = getRedis()
    # r.hset("FNC_WARRING", "dfp", mResult)  # 将内容写入redis  ##正式环境
    # rDebug.hset("SHAPE_WARRING", fnc_type, result)  # 将内容写入redis  ##测试环境
    rDebug.hset("Test_WARRING", fnc_type, result)  # 将内容写入redis  ##测试环境
    # # 四点共振短线
    # if (type == 1):
    #     mResult = {'FncName': "四点共振短线", 'Data': result, 'Fnc_type': 1}
    #     # r.hset("FNC_WARRING", "sdgz_dx", mResult)  # 将内容写入redis
    #     rDebug.hset("FNC_WARRING", "sdgz_dx", mResult)  # 将内容写入redis
    #
    #     pass
    # # 一阳穿多线
    # if (type == 2):
    #     mResult = {'FncName': "一阳穿多线", 'Data': result, 'Fnc_type': 2}
    #     # r.hset("FNC_WARRING", "yycdx", mResult)  # 将内容写入redis
    #     rDebug.hset("FNC_WARRING", "yycdx", mResult)  # 将内容写入redis
    #     pass
    # # 长下影线
    # if (type == 3):
    #     mResult = {'FncName': "长下影线", 'Data': result, 'Fnc_type': 3}
    #     # r.hset("FNC_WARRING", "cxyx", mResult)  # 将内容写入redis
    #     rDebug.hset("FNC_WARRING", "cxyx", mResult)  # 将内容写入redis
    #     pass
    # # 四点共振中线
    # if (type == 4):
    #     mResult = {'FncName': "四点共振中线", 'Data': result, 'Fnc_type': 4}
    #     # r.hset("FNC_WARRING", "sdgz_zx", mResult)  # 将内容写入redis
    #     rDebug.hset("FNC_WARRING", "sdgz_zx", mResult)  # 将内容写入redis
    #     pass
    # # 早晨之星
    # if (type == 5):
    #     mResult = {'FncName': "早晨之星", 'Data': result, 'Fnc_type': 5}
    #     # r.hset("FNC_WARRING", "zczx", mResult)  # 将内容写入redis
    #     rDebug.hset("FNC_WARRING", "zczx", mResult)  # 将内容写入redis
    #     pass
    # # 多方炮
    # if (type == 6):
    #     mResult = {'FncName': "多方炮", 'Data': result, 'Fnc_type': 6}
    #     # r.hset("FNC_WARRING", "dfp", mResult)  # 将内容写入redis
    #     rDebug.hset("FNC_WARRING", "dfp", mResult)  # 将内容写入redis
    #     pass
    # # 多方炮
    # if (type == 7):
    #     mResult = {'FncName': "放量上攻", 'Data': result, 'Fnc_type': 7}
    #     # r.hset("FNC_WARRING", "dfp", mResult)  # 将内容写入redis
    #     rDebug.hset("SHAPE_WARRING", "flsg", mResult)  # 将内容写入redis
    #     pass
def getReleaseRedis():
    redisObkect = redis.StrictRedis(host='39.105.51.148', port=6379, db=0, password='Mysqlycjr0715#',
                                    decode_responses=True)

    # redisObkect = redis.StrictRedis(host='192.168.0.164', port=6379, db=0, password='123456', decode_responses=True)
    return redisObkect

def getRedis():
    # redisObkect = redis.StrictRedis(host='192.168.0.164', port=6379, db=0, password='Mysqlycjr0715#', decode_responses=True)
    redisObkect = redis.StrictRedis(host='192.168.0.164', port=6379, db=0, password='123456', decode_responses=True)
    return redisObkect